<?php
/**
 * Created by PhpStorm.
 * User: white
 * Date: 2020/5/14
 * Time: 14:51
 */
namespace app\api\behavior;

use think\Response;

class CORS
{
    //跨域
    public function appInit(&$params)
    {
        header('Access-Control-Allow-Origin: *');
        header("Access-Control-Allow-Headers: token,Origin, X-Requested-With, Content-Type, Accept");
        header('Access-Control-Allow-Methods: POST,GET,PATCH');
        if (request()->isOptions()) {
            exit();
        }

    }
}